CC = gcc
AR = ar cru
SRC = panda/panda.cc panda/Utils.cc panda/Threads.cc panda/Facade.cc panda/Network.cc panda/HttpHandler.cc panda/SockHandler.cc core/MemCache.cc core/MemConnection.cc core/aclHandler.cc core/Helper.cc core/dlfacade.cc 

CFLAGS = -Wall -D_REENTRANT -D_GNU_SOURCE -fPIC  -g3 `pkg-config --cflags --libs glib-2.0`
SOFLAGS = -shared
LDFLAGS =   # -lresolv

LINKER = $(CC)
LINT = lint -c
RM = /bin/rm -f

LIBS = -L/home/y/lib -L/usr/local/lib -L/usr/lib  \
	   -lmemcached -levent  -pthread \
            -lstdc++ -lglib-2.0  -ldl 
 

INCLUDES =  -I/home/y/include -I/usr/local/include -I./core -I./panda -I/usr/include  -I/usr/include 

 
OPTFLAG = -fno-default-inline -D_PTHREAD_SAFE  -D_DEBUG  

CFLAGS  += $(INCLUDES) 
CFLAGS  += $(OPTFLAG) 
LDFLAGS += $(LIBS) 
#--------------------------------------------------------------------
OBJS = $(SRC:.cc=.o)
TARGET = bin/panda
#--------------------------------------------------------------------
all:$(TARGET)
bin/panda:$(OBJS)
	$(LINKER) $(LDFLAGS) $(OBJS) -o $@

clean:
	@( $(RM) *.o vgcore.*  $(TARGET) )
	rm core/*.o panda/*.o  bin/panda
#--------------------------------------------------------------------
# make rule
%.o : %.cc
	$(CC) $(CFLAGS) -c $^ -o $@	

%.o : %.cpp
	$(CC) $(CFLAGS) -c $^ -o $@	

